{extend name="user/layout" /}

{block name="title"}{$user.username} 点赞列表{/block}

{block name="main"}
<main role="main" class="d-flex flex-grow-1">
    <div class="d-flex main-wrap justify-content-between min-vh-100">
        <!-- 中间内容列 -->
        <div class="primary-col">
            <!-- 顶部导航条 -->
            <div class="breadcrumb d-flex align-items-center px-3 js-scroll">
                <div class="btn btn-sm btn-icon me-3 js-back" aria-label="返回" role="button" tabindex="0">
                    <i class="iconfont icon-left-arrow fs-5"></i>
                </div>
                <h2 class="flex-fill fs-18px fw-bold cursor-pointer js-top">
                    <span class="text-truncate">{$user.username}</span>
                </h2>
            </div>

            <!-- 用户信息 -->
            {include file="user/_user_cover"}
            {include file="user/_user_cover_nav"}

            <!-- 无帖子提示 -->
            {if !$likes[0]}
                <div class="empty-text fs-3">空空如也</div>
            {else /}
                <ul class="feed-list list-unstyled">
                {foreach $likes[0] as $like}
                <li class="feed-item d-flex js-tap" id="feed{$like.post_id}" data-href="/post/show/{$like.post_id}" data-pid="{$like.post_id}">
                    <a href="/user/profile/{$like.user_id}" class="position-relative">
                        <img class="avatar lazyload" src="{:get_avatar($like.user_id)}" loading="lazy" alt="">
                        {if $like.is_sticky}
                        <div class="avatar-badge bg-danger">
                            <i class="iconfont icon-thumbtack text-white"></i>
                        </div>
                        {/if}
                    </a>
                    <div class="d-flex flex-column w-100">
                        <div class="d-flex position-relative">
                            <a class="feed-item-link fw-bold" href="/user/profile/{$like.user_id}">{$like.username}</a>
                            <a class="link-secondary ms-2" href="/post/show/{$like.user_id}">{:nice_time($like.created_at)}</a>
                        </div>
                        <p class="typo-text mt-1 fs-6">{$like.content | raw}</p>
                        <!-- 图片附件 -->
                        {:generate_image_html($likes)}
                        <div class="mt-1 d-flex justify-content-between post-actions">
                            <!-- 回复 -->
                            <a role="button" class="post-action-reply cursor-arrow" title="回复">
                                <div class="btn btn-sm btn-icon post-action-icon">
                                    <i class="iconfont icon-comment fs-18px js-no-click"></i>
                                    <span class="badge fs-13px">{$like.comments ?: ''}</span>
                                </div>
                            </a>

                            <!-- 转帖 -->
                            <a href="javascript:;" class="post-action-retweet cursor-default" title="转帖">
                                <div class="btn btn-sm btn-icon post-action-icon">
                                    <i class="iconfont icon-retweet fs-18px js-no-click"></i>
                                    <span class="badge fs-13px">{$like.comments ?: ''}</span>
                                </div>
                            </a>

                            <!-- 喜欢 -->
                            <a href="javascript:;" class="post-action-like cursor-default" title="赞">
                                <div class="btn btn-sm btn-icon post-action-icon">
                                    <i class="iconfont icon-thumbs-up fs-18px js-no-click"></i>
                                    <span class="badge fs-13px">{$like.likes ?: ''}</span>
                                </div>
                            </a>

                            <!-- 收藏 -->
                            <a href="javascript:;" class="post-action-fav cursor-default" title="收藏">
                                <div class="btn btn-sm btn-icon post-action-icon">
                                    <i class="iconfont icon-fav fs-18px js-no-click"></i>
                                    <span class="badge fs-13px">{$like.favorites ?: ''}</span>
                                </div>
                            </a>
                        </div>
                    </div>
                </li>
                {/foreach}
                </ul>
            {/if}

            <!-- 分页 -->
            {:render_pagination($likes[1])}
        </div>
    </div>
</main>

{/block}

{block name="js"}

<script>
    document.addEventListener("DOMContentLoaded", (e) => {
        // 当前链接添加 active
        highlightActiveLink("user");
        document.getElementById("my-likes").classList.add('active');
    });
</script>
{/block}